//
//  TitleTableViewCell.m
//  NBTripe
//
//  Created by Lee on 16/1/8.
//  Copyright © 2016年 Vicki. All rights reserved.
//

#import "TitleTableViewCell.h"

@implementation TitleTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.marklabel = [[UILabel alloc] init];
        //self.titletitle = [[NSString alloc] init];
        self.marklabel.backgroundColor = [UIColor colorWithRed:0.29 green:0.74 blue:0.8 alpha:1];
        self.allbutton = [UIButton buttonWithType:UIButtonTypeSystem];
       // self.allbutton.backgroundColor = [UIColor yellowColor];
        self.titlelabel = [[UILabel alloc] init];
        self.titlelabel.font = [UIFont boldSystemFontOfSize:15];
        self.titlelabel.textColor = [UIColor darkGrayColor];
        
      //  self.titlelabel.backgroundColor = [UIColor redColor];
        [self addSubview:self.marklabel];
        [self addSubview:self.allbutton];
        [self addSubview:self.titlelabel];
      
    }
    return self;
}
- (void)setTitletitle:(NSString *)titletitle {
    if (_titletitle != titletitle) {
        _titletitle = titletitle;
    }
    self.titlelabel.text = _titletitle;
}


- (void)layoutSubviews {
    [super layoutSubviews];
    self.marklabel.frame = CGRectMake(5*XWIDTH, 7*XHIGHT, 15*XWIDTH, 15*XWIDTH);
    self.marklabel.layer.masksToBounds = YES;
    self.marklabel.layer.cornerRadius = 8*XWIDTH;
    self.titlelabel.frame = CGRectMake(self.marklabel.right + 20*XWIDTH, 5*XHIGHT, WIDTH/2, 20*XHIGHT);
    self.allbutton.frame = CGRectMake(WIDTH-50, 5*XHIGHT, 50*XWIDTH, 20*XHIGHT);
}
- (void)qianjinbutton {
    UIButton *qianjinbutton = [UIButton buttonWithType:UIButtonTypeSystem];
    qianjinbutton.frame = CGRectMake(WIDTH-35, 5*XHIGHT, 20*XWIDTH, 20*XHIGHT);
    [qianjinbutton setBackgroundImage:[UIImage imageNamed:@"qianjin"] forState:UIControlStateNormal];
    //qianjinbutton.backgroundColor = [UIColor purpleColor];
    [qianjinbutton addTarget:self action:@selector(didPress) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:qianjinbutton];
}
- (void)didPress {
    [self.pagedelegate nextpage];
}

- (void)awakeFromNib {
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
